Complex Complex

Complex number with overloaded operators

Information

Complex number defined as a record containing real and imaginary part, utilizing operator overloading.

Licensed by the Modelica Association under the 3-Clause BSD License
Copyright © 2010-2020, Modelica Association and contributors

This Modelica package is free software and the use is completely at your own risk; it can be redistributed and/or modified under the terms of the 3-Clause BSD license. For license conditions (including the disclaimer of warranty) visit https://modelica.org/licenses/modelica-3-clause-bsd.

Parameters

NameDescription
reReal part of complex number
imImaginary part of complex number

Package Content

Name Description
Complex.'constructor' 'constructor' Constructor
Complex.'0' '0' Zero-element of addition (= Complex(0))
Complex.'-' '-' Unary and binary minus
Complex.'*' '*' Multiplication
Complex.'+' '+' Add two complex numbers
Complex.'/' '/' Divide two complex numbers
Complex.'^' '^' Complex power of complex number
Complex.'==' '==' Test whether two complex numbers are identical
Complex.'<>' '<>' Test whether two complex numbers are not identical
Complex.'String' 'String' Transform Complex number into a String representation

Complex.'constructor'

Constructor

Information

Here the constructor operator(s) is/are defined.

Package Content

Name Description
Complex.'constructor'.fromReal fromReal Construct Complex from Real

Complex.'constructor'.fromReal

Construct Complex from Real

Information

This function returns a Complex number defined by real part re and optional imaginary part im (default=0).

Inputs

NameDescription
reReal part of complex number
imImaginary part of complex number

Outputs

NameDescription
resultComplex number

Complex.'0'

Zero-element of addition (= Complex(0))

Information

This function returns the zero-element of Complex, that is, Complex(0) = 0 + j*0.

Outputs

NameDescription
resultComplex(0)

Complex.'-'

Unary and binary minus

Information

Here the unary and binary minus operator(s) is/are defined.

Package Content

Name Description
Complex.'-'.negate negate Unary minus (multiply complex number by -1)
Complex.'-'.subtract subtract Subtract two complex numbers

Complex.'-'.negate

Unary minus (multiply complex number by -1)

Information

This function returns the binary minus of the given Complex number.

Inputs

NameDescription
c1Complex number

Outputs

NameDescription
c2= -c1

Complex.'-'.subtract

Subtract two complex numbers

Information

This function returns the difference of two given Complex numbers.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
c3= c1 - c2

Complex.'*'

Multiplication

Information

Here the multiplication operator(s) is/are defined.

Package Content

Name Description
Complex.'*'.multiply multiply Multiply two complex numbers
Complex.'*'.scalarProduct scalarProduct Scalar product c1*c2 of two complex vectors

Complex.'*'.multiply

Multiply two complex numbers

Information

This function returns the product of two given Complex numbers.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
c3= c1*c2

Complex.'*'.scalarProduct

Scalar product c1*c2 of two complex vectors

Information

This function returns the scalar product of two given arrays of Complex numbers.

Inputs

NameDescription
c1[:]Vector of Complex numbers 1
c2[size(c1, 1)]Vector of Complex numbers 2

Outputs

NameDescription
c3= c1*c2

Complex.'+'

Add two complex numbers

Information

This function returns the sum of two given Complex numbers.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
c3= c1 + c2

Complex.'/'

Divide two complex numbers

Information

This function returns the quotient of two given Complex numbers.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
c3= c1/c2

Complex.'^'

Complex power of complex number

Information

This function returns the given Complex numbers c1 to the power of the Complex number c2.

Inputs

NameDescription
c1Complex number
c2Complex exponent

Outputs

NameDescription
c3= c1^c2

Complex.'=='

Test whether two complex numbers are identical

Information

This function tests whether two given Complex numbers are equal.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
resultc1 == c2

Complex.'<>'

Test whether two complex numbers are not identical

Information

This function tests whether two given Complex numbers are not equal.

Inputs

NameDescription
c1Complex number 1
c2Complex number 2

Outputs

NameDescription
resultc1 <> c2

Complex.'String'

Transform Complex number into a String representation

Information

This function converts a given Complex number to String representation.

Inputs

NameDescription
cComplex number to be transformed in a String representation
nameName of variable representing sqrt(-1) in the string
significantDigitsNumber of significant digits that are shown

Outputs

NameDescription
s 
Automatically generated Fri Oct 2 13:07:11 2020.